Skip to content

Cheetah actions - #47

Merged
roussel-ryan merged 17 commits into
mainfrom
cheetah-actions
Jul 14, 2026
Merged

Cheetah actions#47
roussel-ryan merged 17 commits into
mainfrom
cheetah-actions

Conversation

@roussel-ryan

@roussel-ryan roussel-ryan commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a new Cheetah action layer for the virtual accelerator, removes the old custom transformer, updates dependency management to use PyPI releases instead of direct GitHub links, and improves Cheetah-related test coverage. The most important changes are summarized below.


Cheetah Action Layer Implementation:

  • Added a comprehensive new virtual_accelerator/cheetah/actions.py module implementing Cheetah-backed action-variable classes for magnets, cavities, screens, and other devices, with proper unit conversions and read-only/read-write semantics. This centralizes and standardizes Cheetah PV behavior in the codebase.

Codebase Simplification:

  • Removed the legacy virtual_accelerator/cheetah/transformer.py file, eliminating custom mapping logic in favor of the new action layer.

Dependency Management:

  • Updated pyproject.toml to use PyPI packages for lume-base, lume-bmad, lume-cheetah, lume-torch, and distgen dependencies instead of direct GitHub links, improving reproducibility and installation reliability. [1] [2] [3]

Testing Improvements:

  • Expanded the Cheetah test suite in .github/workflows/test-cheetah.yml to include test_cheetah_actions.py and Cheetah-specific tests from test_cu_hxr.py, ensuring better coverage of the new action layer.

Example Notebook Updates:

  • Updated examples/cheetah_model_example.ipynb for improved usage clarity, including specifying n_particles in model construction, simplifying image retrieval, and correcting the Python version metadata. [1] [2] [3]

These changes modernize the Cheetah integration, streamline maintenance, and improve testability and reproducibility.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces an action-variable layer for Cheetah-backed virtual accelerator PVs, replacing the legacy transformer-based approach and updating tests/CI to exercise the new integration.

Changes:

  • Added virtual_accelerator/cheetah/actions.py and updated virtual_accelerator/cheetah/variables.py to build PV variables via Cheetah action classes.
  • Removed the legacy SLACCheetahTransformer and pared down virtual_accelerator/cheetah/utils.py to CSV mapping helpers only.
  • Expanded/updated tests and CI workflow to cover the new Cheetah action layer and CU_HXR Cheetah model.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
virtual_accelerator/tests/test_optional_dependencies.py Updates optional-import test to reference the new Cheetah actions module.
virtual_accelerator/tests/test_facet.py Consolidates magnet PV mapping tests via parametrization.
virtual_accelerator/tests/test_cu_hxr.py Adds CU_HXR Cheetah model tests and refactors runtime gating logic.
virtual_accelerator/tests/test_cheetah_actions.py Adds unit tests validating action variable roundtrips and factory instantiation.
virtual_accelerator/tests/_bmad_model_test_utils.py Improves PV roundtrip helper to handle booleans and pneumatic-style toggles.
virtual_accelerator/models/cu_hxr.py Adds get_cu_hxr_cheetah_model() using action_variables integration.
virtual_accelerator/cheetah/variables.py Refactors variable factory to instantiate action-layer variables from YAML mappings.
virtual_accelerator/cheetah/utils.py Removes old attribute-mapping logic; keeps only CSV mapping utilities.
virtual_accelerator/cheetah/transformer.py Deletes legacy SLACCheetahTransformer.
virtual_accelerator/cheetah/actions.py Introduces action-variable implementations (magnets, BPMs, cavities, screens).
pyproject.toml Switches lume-base dependency to PyPI release instead of Git URL.
examples/cheetah_model_example.ipynb Updates example usage to new model API patterns and parameters.
.github/workflows/test-cheetah.yml Runs the new Cheetah action tests and CU_HXR Cheetah subset in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread virtual_accelerator/cheetah/actions.py
Comment thread virtual_accelerator/cheetah/actions.py
Comment thread virtual_accelerator/cheetah/actions.py
Comment thread virtual_accelerator/tests/test_cu_hxr.py Outdated
@roussel-ryan
roussel-ryan merged commit 6cbeed5 into main Jul 14, 2026
20 checks passed
@roussel-ryan
roussel-ryan deleted the cheetah-actions branch July 14, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants